package org.huangrui.juc.source.cf;

import java.util.concurrent.CompletableFuture;

/**
 * @Author hr
 * @Create 2024-04-01 14:24
 */
public class T12_CompletableFutureCombine {
    public static void main(String[] args) {
        CompletableFuture<Integer> combine = CompletableFuture.supplyAsync(() -> 10)
                .thenCombine(CompletableFuture.supplyAsync(() -> 20), Integer::sum)
                .thenCombine(CompletableFuture.supplyAsync(() -> 30), Integer::sum);
        System.out.println(combine.join());
    }
}
